Processors use call stacks to temporarily store information associated with functions, tasks, routines or exceptions currently being executed in the processor. Such call stacks have a finite size and are operated in a push/pop fashion: Whenever additional information items are to be stored, they will be “pushed” onto the stack, i.e. stored on top of all information currently residing in the call stack. Upon finishing of a specific task, function or routine, the information items no longer needed on top of the stack may be “popped”, one at a time starting from the top of the stack.
Problems may arise, if the amount of information items pushed onto the call stack exceeds the maximum stack size, causing so-called stack overflow errors. Such errors may for example occur, if interrupt requests (IRQ) are serviced by the processor. The processor then halts the process being currently executed, executes the task according to the current interrupt and returns to the halted process once the interrupt request has been served. Particularly problematic may be nested or recursive IRQs which themselves invoke other interrupts of even higher priority so that more and more information items get pushed onto the call stack without the chance to pop off other information items. Uncontrolled processing of IRQs may thus lead to undesirable stack overflow errors.
The document US 2005/0177667 A1 discloses techniques for controlling memory space usage in a call stack which employ alteration of priority levels of interrupts which are present in the stack. By increasing the priority levels of presently executed interrupts further pre-emption of higher priority interrupts causing an increase in stack memory resources may be effected.
There is, however, a need for improved solutions that are able to prevent stack overflows which solutions are more efficient with regard to memory usage and resource allocation and which are more reliable in terms of effectiveness in stack overflow prevention.